import { createApp, reactive } from 'vue'
import { createPinia } from 'pinia'

import 'normalize.css'
import '@/assets/css/index.less'
import App from './App.vue'
import router from './router'
// 1.全局注册 element-plus：方便和简洁。
import ElementPlus from 'element-plus'
// 国际化。
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

// 引入echarts
import Echarts from 'vue-echarts'
import * as echarts from 'echarts'


// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'


const app = createApp(App)

// 图标。
const iconListName = []

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	iconListName.push(key)
	app.component(key, component)
}
app.provide('$iconListName', iconListName)
// console.log('iconListName ===> ', iconListName)

app.use(createPinia())
app.use(router)
app.use(ElementPlus, {
	locale: zhCn
})
// 使用 Echarts 组件
app.component('e-charts', Echarts)
// 全局挂载 echarts
app.config.globalProperties.$echarts = echarts
app.mount('#app')
